#pragma once

#include <interface/interface.h>
#include <interface/interface_wrapper.h>
#include <interface/global_data_wrapper.h>

class ip_session_op;
class ip_data_manager;
class ip_phone_manager;
class CSoundManager;
class ip_multi_lang_impl;


class dll_object : public virtual aot::tt::idll
{

public:

	dll_object();

	virtual ~dll_object();

	virtual void destroy();	

	virtual const char* interface_name(){ return "idll.ip_phone.dll"; };

public:

	virtual const char* module_name(){ return "ip_phone.dll"; };

	virtual BOOL pre_tans_msg(MSG* msg);

	virtual int on_command (aot::tt::command_t* cmd, aot::tt::result_t* ret = NULL);

	virtual bool on_regist (aot::tt::idll::dll_regist_param_t* p, aot::tt::result_t* ret = NULL);

	virtual bool on_show_window(HWND parent_wnd, const RECT* r, bool show, aot::tt::result_t* ret = NULL);

	virtual int on_sys_event(int event_type, int ev, WPARAM wparam, LPARAM lparam, aot::tt::sys_event_param_t* sep = NULL);

private:

	bool regist_to_frame(aot::tt::idll::dll_regist_param_t* p);

	void regist_sys_event(aot::tt::idll::dll_regist_param_t* p);

	bool regist_to_trans_msg(aot::tt::idll::dll_regist_param_t* p, aot::tt::result_t* ret);

public:

	static aot::tt::imain*				im_;
	HWND								app_hwnd_;

	global_data_wrapper					global_;
	interface_wrapper					i_wrapper_;
	static ip_multi_lang_impl*			ip_multi_lang_impl_;

	ip_phone_manager*					ip_phone_manager_;

};

extern dll_object*			g_dll_obj;
extern global_data_wrapper* get_global();
extern interface_wrapper* get_interface();

extern ip_phone_manager* get_phone_mgr();
extern CSoundManager * get_sound_mgr();
extern ip_data_manager * get_ip_data_mgr();
extern ip_session_op * get_ip_session_op();

extern aot::utility::ireg_exp* get_reg_exp_mgr();
extern aot::data::icontact_op* get_contact_db_op();
extern aot::glb::ienterprise * get_enterprise_db_op();
extern aot::data::icall_record_op* get_record_db_op();
extern aot::sound::isound_card_svc * get_sound_card_svc();
extern aot::voip::ivoip_svc * get_voip_svc();

